function Q_new = findQ2(Q,i,j,P,n)
  Q_new=Q;
  Q1=Q(i,1:n+1)*(1-P(j));
  Q2=[0,Q(i,1:n)]*P(j);
  Q_new(i,1:n+1)=Q1+Q2;
return